home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / giochi / aboulder.lha / ABoulderDash1.0 / main.s < prev    next >
Text File  |  1995-08-27  |  33KB  |  1,505 lines

  1.     opt    L+
  2.     opt    O2+
  3.     opt    OW-
  4.  
  5. *==========================================
  6. *
  7. * File:        main.s
  8. * Version:     1
  9. * Revision:    0
  10. * Created:     3-VII-1993
  11. * By:          FNC Slothouber
  12. * Last Update: 22-Jan-1995
  13. * By:          FNC Slothouber
  14. *
  15. *==========================================
  16.  
  17.     incdir    "include:"
  18.  
  19.     include graphics/graphics_lib.i
  20.     include graphics/view.i
  21.     include hardware/custom.i
  22. *    include hardware/intbits.i
  23.  
  24.     include    exec/exec_lib.i
  25.     include    intuition/intuition.i
  26.  
  27.     include    ExtGfx.i
  28.  
  29.     include execmacros.i
  30.     include    boulderdash.i
  31.  
  32.     XDEF    Play
  33.     XDEF    ted_bitmap_x
  34.     XDEF    ted_grid_field_x
  35.     XDEF    animate_offset_x
  36.     XDEF    ted_bitmap_y
  37.     XDEF    ted_grid_field_y
  38.     XDEF    animate_offset_y
  39.     XDEF    flag_scroll_left
  40.     XDEF    flag_scroll_right
  41.     XDEF    flag_scroll_up
  42.     XDEF    flag_scroll_down
  43.     XDEF    left_row_update
  44.     XDEF    right_row_update
  45.     XDEF    upper_row_update
  46.     XDEF    lower_row_update
  47.     XDEF    flag_view_scroll_left
  48.     XDEF    flag_view_scroll_right
  49.     XDEF    flag_view_scroll_up
  50.     XDEF    flag_view_scroll_down
  51.     XDEF    Editor_Animate
  52.     XDEF    Editor_Draw_One_Object
  53.     XDEF    Update_Score
  54.     XDEF    time_flag
  55.     XDEF    ted_wins_flag
  56.     XDEF    ted_reach_limit
  57.     XDEF    integer_time
  58.     XDEF    integer_score
  59.     XDEF    integer_target
  60.  
  61.     XREF    Calculate
  62.     XREF    Transition
  63.     XREF    grid_field
  64.     XREF    _ExtGfxBase
  65.     XREF    _GfxBase
  66.     XREF    bitmap1
  67.     XREF    bitmap2
  68.     XREF    st_bitmap1
  69.     XREF    st_bitmap2
  70.     XREF    bitmapg
  71.     XREF    display
  72.     XREF    list1
  73.     XREF    list2
  74.     XREF    test_field
  75.     XREF    test_field2
  76.     XREF    list2_right4
  77.     XREF    list2_right12
  78.     XREF    list1_right8
  79.     XREF    list2_left4
  80.     XREF    list2_left12
  81.     XREF    list1_left8
  82.     XREF    list2_up4
  83.     XREF    list2_up12
  84.     XREF    list1_up8
  85.     XREF    list2_down4
  86.     XREF    list2_down12
  87.     XREF    list1_down8
  88.  
  89.     XREF    Draw_Object_32
  90.     XREF    Draw_Object_48
  91.     XREF    Draw_Object
  92.     XREF    Draw_Object_Full_Down_32
  93.     XREF    Scroll_Up
  94.     XREF    Scroll_Down
  95.     XREF    Scroll_Left
  96.     XREF    Scroll_Right
  97.  
  98.     XREF    BD_window
  99.  
  100.     XREF    test_fungis
  101.     XREF    fungis_timer
  102.  
  103.     XREF    AllocRasters
  104.     XREF    FreeRasters
  105.     XREF    EG_AllocBitMap
  106.     XREF    EG_FreeBitMap
  107.     XREF    GetPicture
  108.     XREF    ClearBitMap
  109.     XREF    GetDisplay
  110.     XREF    FreeDisplay
  111.     XREF    CreatePort
  112.     XREF    DeletePort
  113.     XREF    CreateStdIO
  114.     XREF    CreateExtIO
  115.     XREF    DeleteStdIO
  116.     XREF    DeleteExtIO
  117.  
  118.  
  119. CALLEXT        macro
  120.         jsr    \1
  121.         endm
  122.  
  123.  
  124. ***************************************
  125. ***************************************
  126.  
  127. DELAY    equ    0
  128.  
  129. Play ; (Game Time, Game Target, Ted_Dx, Ted_Dy),d0,d1,d2,d3
  130.  
  131. * Copy For Go_To_Ted
  132.     move.w    d2,-(sp)
  133.     move.w    d3,-(sp)
  134.  
  135. * Initialize
  136.     move.w    #0,fungis_timer
  137.     move.w    #TRUE,test_fungis
  138.  
  139. * Make Copy of Game Time and Game Target
  140.     move.w    d0,integer_time
  141.     move.w    d1,integer_target
  142.     move.w    #0,integer_score
  143.  
  144. * Set Flags
  145.     move.w    #TIMELEFT,time_flag
  146.     move.w    #FALSE,ted_wins_flag
  147.     move.w    #FALSE,ted_reach_limit
  148.  
  149. * Convert Game Time To BCD
  150.     lea    time,a0
  151.     divu    #10,d0
  152.     move.l    d0,d2
  153.     swap    d2
  154.     move.b    d2,3(a0)
  155.     and.l    #$ffff,d0
  156.     divu    #10,d0
  157.     move.l    d0,d2
  158.     swap    d2
  159.     move.b    d2,2(a0)
  160.     and.l    #$ffff,d0
  161.     divu    #10,d0
  162.     move.l    d0,d2
  163.     swap    d2
  164.     move.b    d2,1(a0)
  165.     and.l    #$ffff,d0
  166.     divu    #10,d0
  167.     move.l    d0,d2
  168.     swap    d2
  169.     move.b    d2,0(a0)
  170.  
  171. * Convert Game Target To BCD
  172.     lea    target,a0
  173.     divu    #10,d1
  174.     move.l    d1,d2
  175.     swap    d2
  176.     move.b    d2,2(a0)
  177.     and.l    #$ffff,d1
  178.     divu    #10,d1
  179.     move.l    d1,d2
  180.     swap    d2
  181.     move.b    d2,1(a0)
  182.     and.l    #$ffff,d1
  183.     divu    #10,d1
  184.     move.l    d1,d2
  185.     swap    d2
  186.     move.b    d2,0(a0)
  187.  
  188. * Clear All bitmaps
  189.     move.l    bitmap1,a0
  190.     CALLEXT ClearBitMap
  191.  
  192.     move.l    bitmap2,a0
  193.     CALLEXT ClearBitMap
  194.  
  195.     move.l    st_bitmap1,a0
  196.     CALLEXT ClearBitMap
  197.  
  198.     move.l    st_bitmap2,a0
  199.     CALLEXT ClearBitMap
  200.  
  201.     move.l    #3*grid_sizeof,ted_grid_field_x
  202.     move.l    #3*grid_sizeof,ted_bitmap_x
  203.     move.l    #3*grid_sizeof*GRIDF_WIDTH,ted_grid_field_y
  204.     move.l    #3*grid_sizeof*GRIDF_WIDTH,ted_bitmap_y
  205.  
  206.     move.l    grid_field,a2
  207.     sub.l    #grid_sizeof,a2
  208.     move.l    a2,left_row_update
  209.  
  210.     move.l    grid_field,a2
  211.     sub.l    #grid_sizeof*GRIDF_WIDTH,a2
  212.     move.l    a2,upper_row_update
  213.  
  214.     move.l    grid_field,a2
  215.     add.l    #GRIDF_VISIBLE_WIDTH*grid_sizeof,a2
  216.     move.l    a2,right_row_update
  217.  
  218.     move.l    grid_field,a2
  219.     add.l    #GRIDF_VISIBLE_HEIGHT*GRIDF_WIDTH*grid_sizeof,a2
  220.     move.l    a2,lower_row_update
  221.  
  222.     moveq    #0,d0
  223.     move.l    d0,animate_offset_x
  224.     move.l    d0,animate_offset_y
  225.     move.w    d0,flag_scroll_left
  226.     move.w    d0,flag_scroll_right
  227.     move.w    d0,flag_scroll_up
  228.     move.w    d0,flag_scroll_down
  229.     move.w    d0,flag_view_scroll_left
  230.     move.w    d0,flag_view_scroll_right
  231.     move.w    d0,flag_view_scroll_up
  232.     move.w    d0,flag_view_scroll_down
  233.  
  234.     move.w    (sp)+,d3
  235.     move.w    (sp)+,d2
  236.     bsr    Go_To_Ted
  237.  
  238. * Reset Score
  239.     lea    score,a0
  240.     move.b    #0,(a0)+
  241.     move.b    #0,(a0)+
  242.     move.b    #0,(a0)+
  243.     move.w    #1,score_dirty
  244.  
  245. * Display Target Score
  246.     move.l    st_bitmap1,a3
  247.     move.l    bitmapg,a4
  248.     add.l    #bm_Planes,a3
  249.     add.l    #bm_Planes,a4
  250.     bsr    Show_Target
  251.     move.l    st_bitmap2,a3
  252.     move.l    bitmapg,a4
  253.     add.l    #bm_Planes,a3
  254.     add.l    #bm_Planes,a4
  255.     bsr    Show_Target
  256.  
  257. * Start Game
  258.  
  259. .wait    move.l    display,a2
  260.     move.l    dsp_View(a2),a1
  261.     move.l    list2,v_LOFCprList(a1)
  262.  
  263.     move.w    flag_view_scroll_right,d0
  264.     beq    .viewr0
  265.     move.l    list2_right12,v_LOFCprList(a1)
  266.     move.w    #NO_SCROLL,flag_view_scroll_right
  267. .viewr0
  268.     move.w    flag_view_scroll_left,d0
  269.     beq    .viewl0
  270.     move.l    list2_left12,v_LOFCprList(a1)
  271.     move.w    #NO_SCROLL,flag_view_scroll_left
  272. .viewl0
  273.     move.w    flag_view_scroll_up,d0
  274.     beq    .viewu0
  275.     move.l    list2_up12,v_LOFCprList(a1)
  276.     move.w    #NO_SCROLL,flag_view_scroll_up
  277. .viewu0
  278.     move.w    flag_view_scroll_down,d0
  279.     beq    .viewd0
  280.     move.l    list2_down12,v_LOFCprList(a1)
  281.     move.w    #NO_SCROLL,flag_view_scroll_down
  282. .viewd0
  283.     GRAFCALL LoadView
  284.     move.w    #DELAY,d2
  285. .del0    GRAFCALL WaitTOF
  286.     dbra    d2,.del0
  287.  
  288. *--------------------------------------
  289. * Animate Phase 0
  290. *--------------------------------------
  291.  
  292.     move.l    grid_field,a2
  293.     jsr    Calculate
  294.  
  295.     move.w    flag_scroll_left,d0
  296.     beq    .no_scroll1
  297.     move.l    bitmap1,a3
  298.     bsr    Scroll_Left
  299.     move.l    left_row_update,a2
  300.     bsr    Update_Row
  301. .no_scroll1
  302.  
  303.     move.w    flag_scroll_right,d0
  304.     beq    .no_scroll1r
  305.     move.l    bitmap1,a3
  306.     bsr    Scroll_Right
  307.     move.l    right_row_update,a2
  308.     bsr    Update_Row
  309. .no_scroll1r
  310.  
  311.     move.w    flag_scroll_up,d0
  312.     beq    .no_scroll1u
  313.     move.l    bitmap1,a3
  314.     bsr    Scroll_Up
  315.     move.l    upper_row_update,a2
  316.     bsr    Update_Row2
  317. .no_scroll1u
  318.  
  319.     move.w    flag_scroll_down,d0
  320.     beq    .no_scroll1d
  321.     move.l    bitmap1,a3
  322.     bsr    Scroll_Down
  323.     move.l    lower_row_update,a2
  324.     bsr    Update_Row2
  325. .no_scroll1d
  326.  
  327.     move.l    grid_field,a2
  328.     add.l    animate_offset_x,a2
  329.     add.l    animate_offset_y,a2
  330.     move.l    bitmap1,a3
  331.     move.l    bitmapg,a4
  332.     add.l    #bm_Planes,a3
  333.     add.l    #bm_Planes,a4
  334.  
  335.     GRAFCALL WaitBlit
  336.     bsr    Animate
  337.  
  338.     GRAFCALL WaitBlit
  339.  
  340.     move.l    st_bitmap1,a3
  341.     move.l    bitmapg,a4
  342.     add.l    #bm_Planes,a3
  343.     add.l    #bm_Planes,a4
  344.     bsr    Show_Time
  345.  
  346.     move.w    score_dirty,d0
  347.     beq    .no_score
  348.     move.l    st_bitmap1,a3
  349.     move.l    bitmapg,a4
  350.     add.l    #bm_Planes,a3
  351.     add.l    #bm_Planes,a4
  352.     bsr    Show_Score
  353. .no_score
  354.  
  355.     move.l    display,a2
  356.     move.l    dsp_View(a2),a1
  357.     move.l    list1,v_LOFCprList(a1)
  358.     GRAFCALL LoadView
  359.     move.w    #DELAY,d2
  360. .del1    GRAFCALL WaitTOF
  361.     dbra    d2,.del1
  362.  
  363. *-------------------------------------
  364. * Animate Phase 4
  365. *-------------------------------------
  366.  
  367.     move.w    flag_scroll_left,d0
  368.     beq    .no_scroll2
  369.     move.l    bitmap2,a3
  370.     bsr    Scroll_Left
  371.     move.w    #NO_SCROLL,flag_scroll_left
  372. .no_scroll2
  373.  
  374.     move.w    flag_scroll_right,d0
  375.     beq    .no_scroll2r
  376.     move.l    bitmap2,a3
  377.     bsr    Scroll_Right
  378.     move.w    #NO_SCROLL,flag_scroll_right
  379. .no_scroll2r
  380.  
  381.     move.w    flag_scroll_up,d0
  382.     beq    .no_scroll2u
  383.     move.l    bitmap2,a3
  384.     bsr    Scroll_Up
  385.     move.w    #NO_SCROLL,flag_scroll_up
  386. .no_scroll2u
  387.  
  388.     move.w    flag_scroll_down,d0
  389.     beq    .no_scroll2d
  390.     move.l    bitmap2,a3
  391.     bsr    Scroll_Down
  392.     move.w    #NO_SCROLL,flag_scroll_down
  393. .no_scroll2d
  394.  
  395.     move.l    grid_field,a2
  396.     add.l    animate_offset_x,a2
  397.     add.l    animate_offset_y,a2
  398.     move.l    bitmap2,a3
  399.     move.l    bitmapg,a4
  400.     add.l    #bm_Planes,a3
  401.     add.l    #bm_Planes,a4
  402.  
  403.     GRAFCALL WaitBlit
  404.     bsr    Animate
  405.  
  406.     GRAFCALL WaitBlit
  407.     move.l    st_bitmap2,a3
  408.     move.l    bitmapg,a4
  409.     add.l    #bm_Planes,a3
  410.     add.l    #bm_Planes,a4
  411.     bsr    Show_Time
  412.  
  413.     move.w    score_dirty,d0
  414.     beq    .no_score2
  415.     move.l    st_bitmap2,a3
  416.     move.l    bitmapg,a4
  417.     add.l    #bm_Planes,a3
  418.     add.l    #bm_Planes,a4
  419.     bsr    Show_Score
  420.     move.w    #0,score_dirty
  421. .no_score2
  422.  
  423.     move.l    display,a2
  424.     move.l    dsp_View(a2),a1
  425.     move.l    list2,v_LOFCprList(a1)
  426.     move.w    flag_view_scroll_right,d0
  427.     beq    .viewr2
  428.     move.l    list2_right4,v_LOFCprList(a1)
  429. .viewr2
  430.     move.w    flag_view_scroll_left,d0
  431.     beq    .viewl2
  432.     move.l    list2_left4,v_LOFCprList(a1)
  433. .viewl2
  434.     move.w    flag_view_scroll_up,d0
  435.     beq    .viewu2
  436.     move.l    list2_up4,v_LOFCprList(a1)
  437. .viewu2
  438.     move.w    flag_view_scroll_down,d0
  439.     beq    .viewd2
  440.     move.l    list2_down4,v_LOFCprList(a1)
  441. .viewd2
  442.     GRAFCALL LoadView
  443.     move.w    #DELAY,d2
  444. .del2    GRAFCALL WaitTOF
  445.     dbra    d2,.del2
  446.  
  447. *-------------------------------------
  448. * Animate Phase 8
  449. *-------------------------------------
  450.  
  451.     move.l    grid_field,a2
  452.     add.l    animate_offset_x,a2
  453.     add.l    animate_offset_y,a2
  454.     move.l    bitmap1,a3
  455.     move.l    bitmapg,a4
  456.     add.l    #bm_Planes,a3
  457.     add.l    #bm_Planes,a4
  458.     bsr    Animate
  459.  
  460.     move.l    display,a2
  461.     move.l    dsp_View(a2),a1
  462.     move.l    list1,v_LOFCprList(a1)
  463.     move.w    flag_view_scroll_right,d0
  464.     beq    .viewr3
  465.     move.l    list1_right8,v_LOFCprList(a1)
  466. .viewr3
  467.     move.w    flag_view_scroll_left,d0
  468.     beq    .viewl3
  469.     move.l    list1_left8,v_LOFCprList(a1)
  470. .viewl3
  471.     move.w    flag_view_scroll_up,d0
  472.     beq    .viewu3
  473.     move.l    list1_up8,v_LOFCprList(a1)
  474. .viewu3
  475.     move.w    flag_view_scroll_down,d0
  476.     beq    .viewd3
  477.     move.l    list1_down8,v_LOFCprList(a1)
  478. .viewd3
  479.     GRAFCALL LoadView
  480.     move.w    #DELAY,d2
  481. .del3    GRAFCALL WaitTOF
  482.     dbra    d2,.del3
  483.  
  484. *-------------------------------------
  485. * Animate Phase 12
  486. *-------------------------------------
  487.  
  488.     move.l    grid_field,a2
  489.     add.l    animate_offset_x,a2
  490.     add.l    animate_offset_y,a2
  491.     move.l    bitmap2,a3
  492.     move.l    bitmapg,a4
  493.     add.l    #bm_Planes,a3
  494.     add.l    #bm_Planes,a4
  495.     bsr    Animate
  496.  
  497.     move.l    grid_field,a2
  498.     jsr    Transition
  499.     bsr    Update_Time
  500.  
  501.     move.w    ted_wins_flag,d0
  502.     bne    .ted_wins
  503.  
  504.     move.l    BD_window,a0
  505.     move.l    wd_UserPort(a0),a0
  506.     EXECCALL GetMsg
  507.     move.l    d0,d1
  508.     beq    .wait
  509.     move.l    d0,a1
  510.  
  511.     move.l    im_Class(a1),d0
  512.     cmp.l    #RAWKEY,d0
  513.     beq.s    .test2
  514.     EXECCALL ReplyMsg
  515.     bra    .wait
  516. .test2    cmp.w    #$45,im_Code(a1)
  517.     beq.s    .exits
  518.     EXECCALL ReplyMsg
  519.     bra    .wait
  520. .exits    EXECCALL ReplyMsg
  521.     bra    .exit
  522.  
  523. *
  524. * ** Ted Wins the game **
  525. *
  526. .ted_wins
  527.  
  528. .exit    rts
  529.  
  530.  
  531. *
  532. * Move Screen to Begin Pos Ted 
  533. *
  534.  
  535. Go_To_Ted ; (Dx,Dy),d2,d3
  536.  
  537.     subq.w    #1,d2
  538.     bmi    .next
  539.  
  540. .loopx    move.l    ted_bitmap_x,d0
  541.     addq.l    #grid_sizeof,d0
  542.     move.l    animate_offset_x,d1
  543.     cmp.l    #SCROLL_LEFT_MAX,d1
  544.     bhs.s    .noscroll
  545.     cmp.l    #SCROLL_LEFT,d0
  546.     bls.s    .noscroll
  547.  
  548. * Move Right Scroll Left
  549.     move.l    animate_offset_x,d0
  550.     addq.l    #grid_sizeof,d0
  551.     move.l    d0,animate_offset_x
  552.     move.l    left_row_update,d0
  553.     addq.l    #grid_sizeof,d0
  554.     move.l    d0,left_row_update
  555.     move.l    right_row_update,d0
  556.     addq.l    #grid_sizeof,d0
  557.     move.l    d0,right_row_update
  558.     bra    .cont
  559. .noscroll
  560. * Move Right
  561.     move.l    ted_bitmap_x,d0
  562.     addq.l    #grid_sizeof,d0
  563.     move.l    d0,ted_bitmap_x
  564.  
  565. .cont    move.l    ted_grid_field_x,d0
  566.     add.l    #grid_sizeof,d0
  567.     move.l    d0,ted_grid_field_x
  568.  
  569.     dbra    d2,.loopx
  570. .next
  571.  
  572.     subq.w    #1,d3
  573.     bmi    .exit
  574.  
  575. .loopy    move.l    ted_bitmap_y,d0
  576.     add.l    #grid_sizeof*GRIDF_WIDTH,d0
  577.     move.l    animate_offset_y,d1
  578.     cmp.l    #SCROLL_UP_MAX,d1
  579.     bhs.s    .noscroll2
  580.     cmp.l    #SCROLL_UP,d0
  581.     bls.s    .noscroll2
  582. * Scroll Up Move Down
  583.     move.l    animate_offset_y,d0
  584.     add.l    #grid_sizeof*GRIDF_WIDTH,d0
  585.     move.l    d0,animate_offset_y
  586.     move.l    upper_row_update,d0
  587.     add.l    #grid_sizeof*GRIDF_WIDTH,d0
  588.     move.l    d0,upper_row_update
  589.     move.l    lower_row_update,d0
  590.     add.l    #grid_sizeof*GRIDF_WIDTH,d0
  591.     move.l    d0,lower_row_update
  592.     bra    .cont2
  593. .noscroll2
  594. * Move Down
  595.     move.l    ted_bitmap_y,d0
  596.     add.l    #grid_sizeof*GRIDF_WIDTH,d0
  597.     move.l    d0,ted_bitmap_y
  598.  
  599. .cont2    move.l    ted_grid_field_y,d0
  600.     add.l    #grid_sizeof*GRIDF_WIDTH,d0
  601.     move.l    d0,ted_grid_field_y
  602.  
  603.     dbra    d3,.loopy
  604. .exit    rts
  605.  
  606. *
  607. * Update_Row
  608. *
  609.  
  610. Update_Row ; (grid_field),a2
  611.  
  612. Ulr_REGS    REG    D2
  613.  
  614.     movem.l    Ulr_REGS,-(sp)
  615.  
  616.     move.w    #GRIDF_HEIGHT-1,d0
  617.     moveq    #2,d1
  618.     move.l    #GRIDF_WIDTH*grid_sizeof,d2
  619. .loop
  620.     move.b    d1,grid_dirty(a2)
  621.     add.l    d2,a2
  622.     dbra    d0,.loop
  623.  
  624.     movem.l    (sp)+,Ulr_REGS
  625.     rts
  626.  
  627. *
  628. * Update_Row2
  629. *
  630.  
  631. Update_Row2 ; (grid_field),a2
  632.  
  633.     move.w    #GRIDF_WIDTH-1,d0
  634.     moveq    #2,d1
  635. .loop
  636.     move.b    d1,grid_dirty(a2)
  637.     addq    #grid_sizeof,a2
  638.     dbra    d0,.loop
  639.  
  640.     rts
  641.  
  642. *
  643. * Animate
  644. *
  645. *   A0                           D0
  646. *   A1                           D1
  647. *   A2 - grid field              D2 - offset_disp
  648. *   A3 - display planes          D3 - offset_image
  649. *   A4 - image planes            D4 - offset into bitplane
  650. *   A5 - Custom Base             D5 - depth count
  651. *                                D6 - grid_x
  652. *                                D7 - grid_y
  653.  
  654. Animate ; (Grid_Field,Display_Planes,Image_Planes),a2,a3,a4
  655.  
  656. * Initialize blitter
  657.     move.l    #$dff000,a5
  658.     GRAFCALL OwnBlitter
  659.     GRAFCALL WaitBlit
  660.     move.w    #$09f0,bltcon0(a5)        ; D=A  Use A, Use D
  661.     move.w    #$0000,bltcon1(a5)
  662.     move.w    #$ffff,bltafwm(a5)
  663.     move.w    #$ffff,bltalwm(a5)
  664.  
  665. ; 16 pixels animation buffer for horizontal animation
  666. ; 16 pixels animation buffer for vertical animation
  667.     move.l    #BM_width*GRID_OBJECT_HEIGHT+(GRID_OBJECT_WIDTH/8),d4
  668.  
  669.     move.w    #GRIDF_VISIBLE_HEIGHT-1,d7
  670. .ll0    move.w    #GRIDF_VISIBLE_WIDTH-1,d6
  671.  
  672. * test if the grid needs to be drawn
  673. .ll1    move.b    grid_dirty(a2),d0
  674.     beq    .next
  675.     subq.b    #1,d0
  676.     move.b    d0,grid_dirty(a2)
  677.  
  678. * draw the grid
  679.     move.l    d4,d2
  680.     moveq    #0,d1
  681.     move.w    grid_draw(a2),d1
  682.     beq    .next
  683.     pea    .next
  684.     jmp    animate_table_entry
  685.  
  686. * next grid
  687. .next    addq.l    #grid_sizeof,a2
  688.     add.l    #GRID_OBJECT_WIDTH/8,d4
  689.     dbra    d6,.ll1
  690.     add.l    #grid_sizeof*(GRIDF_WIDTH-GRIDF_VISIBLE_WIDTH),a2
  691.     add.l    #BM_width*(GRID_OBJECT_HEIGHT-1)+(BM_width-(2*GRIDF_VISIBLE_WIDTH)),d4
  692.     dbra    d7,.ll0
  693.  
  694.     GRAFCALL DisownBlitter
  695.     rts
  696.  
  697.  
  698. *
  699. * Editor_Animate
  700. *
  701. *   A0                           D0
  702. *   A1                           D1
  703. *   A2 - grid field              D2 - offset_disp
  704. *   A3 - display planes          D3 - offset_image
  705. *   A4 - image planes            D4 - offset into bitplane
  706. *   A5 - Custom Base             D5 - depth count
  707. *                                D6 - grid_x
  708. *                                D7 - grid_y
  709.  
  710. Editor_Animate ; (Grid_Field,Display_Planes,Image_Planes),a2,a3,a4
  711.  
  712. * Initialize blitter
  713.     move.l    #$dff000,a5
  714.     GRAFCALL OwnBlitter
  715.     GRAFCALL WaitBlit
  716.     move.w    #$09f0,bltcon0(a5)        ; D=A  Use A, Use D
  717.     move.w    #$0000,bltcon1(a5)
  718.     move.w    #$ffff,bltafwm(a5)
  719.     move.w    #$ffff,bltalwm(a5)
  720.  
  721. ; 32+16 pixels buffer for gadgets and screen title bar
  722.     move.l    #BM_width*(32+16),d4
  723.  
  724.     move.w    #BD_EDIT_FIELD_HEIGHT-1,d7
  725. .ll0    move.w    #BD_EDIT_FIELD_WIDTH-1,d6
  726.  
  727. * test if the grid needs to be drawn
  728. .ll1    move.b    grid_dirty(a2),d0
  729.     beq    .next
  730. *    subq.b    #1,d0
  731. *    move.b    d0,grid_dirty(a2)
  732.  
  733. * draw the grid
  734.     move.l    d4,d2
  735.     moveq    #0,d1
  736.     move.w    grid_draw(a2),d1
  737.     beq    .next
  738.     pea    .next
  739.     jmp    animate_table_entry
  740.  
  741. * next grid
  742. .next    addq.l    #grid_sizeof,a2
  743.     add.l    #GRID_OBJECT_WIDTH/8,d4
  744.     dbra    d6,.ll1
  745.     add.l    #grid_sizeof*(GRIDF_WIDTH-BD_EDIT_FIELD_WIDTH),a2
  746.     add.l    #BM_width*(GRID_OBJECT_HEIGHT-1)+(BM_width-(2*BD_EDIT_FIELD_WIDTH)),d4
  747.     dbra    d7,.ll0
  748.  
  749.     GRAFCALL DisownBlitter
  750.     rts
  751.  
  752.  
  753. *
  754. * Editor_Draw_One_Object
  755. *
  756. *   A0                           D0
  757. *   A1                           D1
  758. *   A2                           D2 
  759. *   A3 - display planes          D3 
  760. *   A4 - image planes            D4 - offset into bitplane
  761. *   A5 - Custom Base             D5 
  762. *                                D6 
  763. *                                D7 
  764.  
  765. Editor_Draw_One_Object ; (Display_Planes,Image_Planes),a3,a4
  766.  
  767. * Initialize blitter
  768.     move.l    #$dff000,a5
  769.     GRAFCALL OwnBlitter
  770.     GRAFCALL WaitBlit
  771.     move.w    #$09f0,bltcon0(a5)        ; D=A  Use A, Use D
  772.     move.w    #$0000,bltcon1(a5)
  773.     move.w    #$ffff,bltafwm(a5)
  774.     move.w    #$ffff,bltalwm(a5)
  775.  
  776.     pea    .next
  777.     jmp    animate_table_entry
  778.  
  779. .next    GRAFCALL DisownBlitter
  780.     rts
  781.  
  782.  
  783. ****************************
  784.  
  785. animate_table_entry
  786.     jmp    animate_tabel(pc,d1)
  787. animate_tabel
  788.     jmp    dummy
  789.     jmp    Draw_Border
  790.     jmp    Draw_Empty
  791.     jmp    Draw_Dirt
  792.     jmp    Draw_Rock
  793.     jmp    Draw_Diamond
  794.     jmp    Draw_Butterfly
  795.     jmp    Draw_Brick
  796.     jmp    Draw_Fungis
  797.     jmp    Draw_Mover
  798.     jmp    Draw_Exit
  799.     jmp    Draw_Rock_Down0
  800.     jmp    Draw_Rock_Down4
  801.     jmp    Draw_Rock_Down8
  802.     jmp    Draw_Rock_Down12
  803.     jmp    Draw_Mover_Down0
  804.     jmp    Draw_Mover_Down4
  805.     jmp    Draw_Mover_Down8
  806.     jmp    Draw_Mover_Down12
  807.     jmp    Draw_Butterfly_Down0
  808.     jmp    Draw_Butterfly_Down4
  809.     jmp    Draw_Butterfly_Down8
  810.     jmp    Draw_Butterfly_Down12
  811.     jmp    Draw_Diamond_Down0
  812.     jmp    Draw_Diamond_Down4
  813.     jmp    Draw_Diamond_Down8
  814.     jmp    Draw_Diamond_Down12
  815.     jmp    Draw_Mover_Up0
  816.     jmp    Draw_Mover_Up4
  817.     jmp    Draw_Mover_Up8
  818.     jmp    Draw_Mover_Up12
  819.     jmp    Draw_Butterfly_Up0
  820.     jmp    Draw_Butterfly_Up4
  821.     jmp    Draw_Butterfly_Up8
  822.     jmp    Draw_Butterfly_Up12
  823.     jmp    Draw_Mover_Right0
  824.     jmp    Draw_Mover_Right4
  825.     jmp    Draw_Mover_Right8
  826.     jmp    Draw_Mover_Right12
  827.     jmp    Draw_Mover_Left0
  828.     jmp    Draw_Mover_Left4
  829.     jmp    Draw_Mover_Left8
  830.     jmp    Draw_Mover_Left12
  831.     jmp    Draw_Butterfly_Right0
  832.     jmp    Draw_Butterfly_Right4
  833.     jmp    Draw_Butterfly_Right8
  834.     jmp    Draw_Butterfly_Right12
  835.     jmp    Draw_Butterfly_Left0
  836.     jmp    Draw_Butterfly_Left4
  837.     jmp    Draw_Butterfly_Left8
  838.     jmp    Draw_Butterfly_Left12
  839.     jmp    Draw_Rock_Right0
  840.     jmp    Draw_Rock_Right4
  841.     jmp    Draw_Rock_Right8
  842.     jmp    Draw_Rock_Right12
  843.     jmp    Draw_Rock_Left0
  844.     jmp    Draw_Rock_Left4
  845.     jmp    Draw_Rock_Left8
  846.     jmp    Draw_Rock_Left12
  847.     jmp    Draw_Diamond_Right0
  848.     jmp    Draw_Diamond_Right4
  849.     jmp    Draw_Diamond_Right8
  850.     jmp    Draw_Diamond_Right12
  851.     jmp    Draw_Diamond_Left0
  852.     jmp    Draw_Diamond_Left4
  853.     jmp    Draw_Diamond_Left8
  854.     jmp    Draw_Diamond_Left12
  855.     jmp    Draw_Ted
  856.     jmp    Draw_Ted_Down0
  857.     jmp    Draw_Ted_Down4
  858.     jmp    Draw_Ted_Down8
  859.     jmp    Draw_Ted_Down12
  860.     jmp    Draw_Ted_Up0
  861.     jmp    Draw_Ted_Up4
  862.     jmp    Draw_Ted_Up8
  863.     jmp    Draw_Ted_Up12
  864.     jmp    Draw_Ted_Left0
  865.     jmp    Draw_Ted_Left4
  866.     jmp    Draw_Ted_Left8
  867.     jmp    Draw_Ted_Left12
  868.     jmp    Draw_Ted_Right0
  869.     jmp    Draw_Ted_Right4
  870.     jmp    Draw_Ted_Right8
  871.     jmp    Draw_Ted_Right12
  872.     jmp    Draw_Ted_Dirt_Left0
  873.     jmp    Draw_Ted_Dirt_Left4
  874.     jmp    Draw_Ted_Dirt_Left8
  875.     jmp    Draw_Ted_Dirt_Left12
  876.     jmp    Draw_Ted_Dirt_Right0
  877.     jmp    Draw_Ted_Dirt_Right4
  878.     jmp    Draw_Ted_Dirt_Right8
  879.     jmp    Draw_Ted_Dirt_Right12
  880.     jmp    Draw_Ted_Rock_Left0
  881.     jmp    Draw_Ted_Rock_Left4
  882.     jmp    Draw_Ted_Rock_Left8
  883.     jmp    Draw_Ted_Rock_Left12
  884.     jmp    Draw_Ted_Rock_Right0
  885.     jmp    Draw_Ted_Rock_Right4
  886.     jmp    Draw_Ted_Rock_Right8
  887.     jmp    Draw_Ted_Rock_Right12
  888.     jmp    Draw_Ted_Dirt_Down0
  889.     jmp    Draw_Ted_Dirt_Down4
  890.     jmp    Draw_Ted_Dirt_Down8
  891.     jmp    Draw_Ted_Dirt_Down12
  892.     jmp    Draw_Ted_Dirt_Up0
  893.     jmp    Draw_Ted_Dirt_Up4
  894.     jmp    Draw_Ted_Dirt_Up8
  895.     jmp    Draw_Ted_Dirt_Up12
  896.     jmp    Draw_Fungis_Right0
  897.     jmp    Draw_Fungis_Right4
  898.     jmp    Draw_Fungis_Right8
  899.     jmp    Draw_Fungis_Left0
  900.     jmp    Draw_Fungis_Left4
  901.     jmp    Draw_Fungis_Left8
  902.     jmp    Draw_Fungis_Up0
  903.     jmp    Draw_Fungis_Up4
  904.     jmp    Draw_Fungis_Up8
  905.     jmp    Draw_Fungis_Down0
  906.     jmp    Draw_Fungis_Down4
  907.     jmp    Draw_Fungis_Down8
  908.     jmp    dummy
  909.     jmp    dummy
  910.     jmp    dummy
  911.     jmp    dummy
  912.     jmp    dummy
  913.     jmp    dummy
  914.  
  915.  
  916. **********************
  917. ** Drawing Routines **
  918. **********************
  919.  
  920. dummy    rts
  921.  
  922. DRAW_SIMPLE    macro
  923.         move.l    #\1,d3
  924.         bra    Draw_Object
  925.         endm
  926.  
  927. Draw_Ted
  928.     DRAW_SIMPLE    IM_TED
  929. Draw_Fungis
  930.     DRAW_SIMPLE    IM_FUNGIS
  931. Draw_Border
  932.     DRAW_SIMPLE    IM_BORDER
  933. Draw_Empty
  934.     DRAW_SIMPLE    IM_EMPTY
  935. Draw_Dirt
  936.     DRAW_SIMPLE    IM_DIRT
  937. Draw_Rock
  938.     DRAW_SIMPLE    IM_ROCK0
  939. Draw_Brick
  940.     DRAW_SIMPLE    IM_BRICK
  941. Draw_Diamond
  942.     DRAW_SIMPLE    IM_DIAMOND0
  943. Draw_Mover
  944.     DRAW_SIMPLE    IM_MOVER0
  945. Draw_Butterfly
  946.     DRAW_SIMPLE    IM_BUTTERFLY0
  947. Draw_Exit
  948.     DRAW_SIMPLE    IM_EXIT
  949.  
  950.  
  951. DRAW_SIM_TRANS    macro
  952.         move.l    #\1,d3
  953.         move.w    #\2,grid_draw(a2)
  954.         bra    Draw_Object
  955.         endm
  956.  
  957. Draw_Fungis_Right0
  958.     DRAW_SIM_TRANS    IM_FUNGIS_RIGHT0,DRAW_FUNGIS_RIGHT4
  959. Draw_Fungis_Right4
  960.     DRAW_SIM_TRANS    IM_FUNGIS_RIGHT4,DRAW_FUNGIS_RIGHT8
  961. Draw_Fungis_Right8
  962.     DRAW_SIM_TRANS    IM_FUNGIS_RIGHT8,DRAW_FUNGIS
  963. Draw_Fungis_Left0
  964.     DRAW_SIM_TRANS    IM_FUNGIS_LEFT0,DRAW_FUNGIS_LEFT4
  965. Draw_Fungis_Left4
  966.     DRAW_SIM_TRANS    IM_FUNGIS_LEFT4,DRAW_FUNGIS_LEFT8
  967. Draw_Fungis_Left8
  968.     DRAW_SIM_TRANS    IM_FUNGIS_LEFT8,DRAW_FUNGIS
  969. Draw_Fungis_Up0
  970.     DRAW_SIM_TRANS    IM_FUNGIS_UP0,DRAW_FUNGIS_UP4
  971. Draw_Fungis_Up4
  972.     DRAW_SIM_TRANS    IM_FUNGIS_UP4,DRAW_FUNGIS_UP8
  973. Draw_Fungis_Up8
  974.     DRAW_SIM_TRANS    IM_FUNGIS_UP8,DRAW_FUNGIS
  975. Draw_Fungis_Down0
  976.     DRAW_SIM_TRANS    IM_FUNGIS_DOWN0,DRAW_FUNGIS_DOWN4
  977. Draw_Fungis_Down4
  978.     DRAW_SIM_TRANS    IM_FUNGIS_DOWN4,DRAW_FUNGIS_DOWN8
  979. Draw_Fungis_Down8
  980.     DRAW_SIM_TRANS    IM_FUNGIS_DOWN8,DRAW_FUNGIS
  981.  
  982.  
  983. DRAW_COMP_TRANS    macro
  984.         move.l    #\1,d3
  985.         move.w    #\2,grid_draw(a2)
  986.         bra    \3
  987.         endm
  988.  
  989. Draw_Mover_Right0
  990.     DRAW_COMP_TRANS    IM_MOVER0,DRAW_MOVER_RIGHT4,Draw_Object_32
  991. Draw_Mover_Right4
  992.     DRAW_COMP_TRANS    IM_MOVER4,DRAW_MOVER_RIGHT8,Draw_Object_32
  993. Draw_Mover_Right8
  994.     DRAW_COMP_TRANS    IM_MOVER8,DRAW_MOVER_RIGHT12,Draw_Object_32
  995. Draw_Mover_Right12
  996.     DRAW_COMP_TRANS    IM_MOVER12,DRAW_MOVER,Draw_Object_32
  997.  
  998. Draw_Mover_Left0
  999.     subq.l    #2,d2
  1000.     DRAW_COMP_TRANS    IM_MOVER16,DRAW_MOVER_LEFT4,Draw_Object_32
  1001. Draw_Mover_Left4
  1002.     subq.l    #2,d2
  1003.     DRAW_COMP_TRANS    IM_MOVER12,DRAW_MOVER_LEFT8,Draw_Object_32
  1004. Draw_Mover_Left8
  1005.     subq.l    #2,d2
  1006.     DRAW_COMP_TRANS    IM_MOVER8,DRAW_MOVER_LEFT12,Draw_Object_32
  1007. Draw_Mover_Left12
  1008.     subq.l    #2,d2
  1009.     DRAW_COMP_TRANS    IM_MOVER4,DRAW_MOVER,Draw_Object_32
  1010.  
  1011. Draw_Butterfly_Right0
  1012.     DRAW_COMP_TRANS    IM_BUTTERFLY0,DRAW_BUTTERFLY_RIGHT4,Draw_Object_32
  1013. Draw_Butterfly_Right4
  1014.     DRAW_COMP_TRANS    IM_BUTTERFLY4,DRAW_BUTTERFLY_RIGHT8,Draw_Object_32
  1015. Draw_Butterfly_Right8
  1016.     DRAW_COMP_TRANS    IM_BUTTERFLY8,DRAW_BUTTERFLY_RIGHT12,Draw_Object_32
  1017. Draw_Butterfly_Right12
  1018.     DRAW_COMP_TRANS    IM_BUTTERFLY12,DRAW_BUTTERFLY,Draw_Object_32
  1019.  
  1020. Draw_Butterfly_Left0
  1021.     subq.l    #2,d2
  1022.     DRAW_COMP_TRANS    IM_BUTTERFLY16,DRAW_BUTTERFLY_LEFT4,Draw_Object_32
  1023. Draw_Butterfly_Left4
  1024.     subq.l    #2,d2
  1025.     DRAW_COMP_TRANS    IM_BUTTERFLY12,DRAW_BUTTERFLY_LEFT8,Draw_Object_32
  1026. Draw_Butterfly_Left8
  1027.     subq.l    #2,d2
  1028.     DRAW_COMP_TRANS    IM_BUTTERFLY8,DRAW_BUTTERFLY_LEFT12,Draw_Object_32
  1029. Draw_Butterfly_Left12
  1030.     subq.l    #2,d2
  1031.     DRAW_COMP_TRANS    IM_BUTTERFLY4,DRAW_BUTTERFLY,Draw_Object_32
  1032.  
  1033. Draw_Rock_Right0
  1034.     DRAW_COMP_TRANS    IM_ROCK0,DRAW_ROCK_RIGHT4,Draw_Object_32
  1035. Draw_Rock_Right4
  1036.     DRAW_COMP_TRANS    IM_ROCK4,DRAW_ROCK_RIGHT8,Draw_Object_32
  1037. Draw_Rock_Right8
  1038.     DRAW_COMP_TRANS    IM_ROCK8,DRAW_ROCK_RIGHT12,Draw_Object_32
  1039. Draw_Rock_Right12
  1040.     DRAW_COMP_TRANS    IM_ROCK12,DRAW_ROCK,Draw_Object_32
  1041.  
  1042.  
  1043. Draw_Rock_Left0
  1044.     subq.l    #2,d2
  1045.     DRAW_COMP_TRANS    IM_ROCK16,DRAW_ROCK_LEFT4,Draw_Object_32
  1046. Draw_Rock_Left4
  1047.     subq.l    #2,d2
  1048.     DRAW_COMP_TRANS    IM_ROCK12,DRAW_ROCK_LEFT8,Draw_Object_32
  1049. Draw_Rock_Left8
  1050.     subq.l    #2,d2
  1051.     DRAW_COMP_TRANS    IM_ROCK8,DRAW_ROCK_LEFT12,Draw_Object_32
  1052. Draw_Rock_Left12
  1053.     subq.l    #2,d2
  1054.     DRAW_COMP_TRANS    IM_ROCK4,DRAW_ROCK,Draw_Object_32
  1055.  
  1056. Draw_Diamond_Right0
  1057.     DRAW_COMP_TRANS    IM_DIAMOND0,DRAW_DIAMOND_RIGHT4,Draw_Object_32
  1058. Draw_Diamond_Right4
  1059.     DRAW_COMP_TRANS    IM_DIAMOND4,DRAW_DIAMOND_RIGHT8,Draw_Object_32
  1060. Draw_Diamond_Right8
  1061.     DRAW_COMP_TRANS    IM_DIAMOND8,DRAW_DIAMOND_RIGHT12,Draw_Object_32
  1062. Draw_Diamond_Right12
  1063.     DRAW_COMP_TRANS    IM_DIAMOND12,DRAW_DIAMOND,Draw_Object_32
  1064.  
  1065.  
  1066. Draw_Diamond_Left0
  1067.     subq.l    #2,d2
  1068.     DRAW_COMP_TRANS    IM_DIAMOND16,DRAW_DIAMOND_LEFT4,Draw_Object_32
  1069. Draw_Diamond_Left4
  1070.     subq.l    #2,d2
  1071.     DRAW_COMP_TRANS    IM_DIAMOND12,DRAW_DIAMOND_LEFT8,Draw_Object_32
  1072. Draw_Diamond_Left8
  1073.     subq.l    #2,d2
  1074.     DRAW_COMP_TRANS    IM_DIAMOND8,DRAW_DIAMOND_LEFT12,Draw_Object_32
  1075. Draw_Diamond_Left12
  1076.     subq.l    #2,d2
  1077.     DRAW_COMP_TRANS    IM_DIAMOND4,DRAW_DIAMOND,Draw_Object_32
  1078.  
  1079. Draw_Ted_Left0
  1080.     subq.l    #2,d2
  1081.     DRAW_COMP_TRANS    IM_TED_LEFT0,DRAW_TED_LEFT4,Draw_Object_32
  1082. Draw_Ted_Left4
  1083.     subq.l    #2,d2
  1084.     DRAW_COMP_TRANS    IM_TED_LEFT4,DRAW_TED_LEFT8,Draw_Object_32
  1085. Draw_Ted_Left8
  1086.     subq.l    #2,d2
  1087.     DRAW_COMP_TRANS    IM_TED_LEFT8,DRAW_TED_LEFT12,Draw_Object_32
  1088. Draw_Ted_Left12
  1089.     subq.l    #2,d2
  1090.     DRAW_COMP_TRANS    IM_TED_LEFT12,DRAW_TED,Draw_Object_32
  1091.  
  1092. Draw_Ted_Right0
  1093.     DRAW_COMP_TRANS    IM_TED_RIGHT0,DRAW_TED_RIGHT4,Draw_Object_32
  1094. Draw_Ted_Right4
  1095.     DRAW_COMP_TRANS    IM_TED_RIGHT4,DRAW_TED_RIGHT8,Draw_Object_32
  1096. Draw_Ted_Right8
  1097.     DRAW_COMP_TRANS    IM_TED_RIGHT8,DRAW_TED_RIGHT12,Draw_Object_32
  1098. Draw_Ted_Right12
  1099.     DRAW_COMP_TRANS    IM_TED_RIGHT12,DRAW_TED,Draw_Object_32
  1100.  
  1101. Draw_Ted_Dirt_Left0
  1102.     subq.l    #2,d2
  1103.     DRAW_COMP_TRANS    IM_TED_DIRT_LEFT0,DRAW_TED_DIRT_LEFT4,Draw_Object_32
  1104. Draw_Ted_Dirt_Left4
  1105.     subq.l    #2,d2
  1106.     DRAW_COMP_TRANS    IM_TED_DIRT_LEFT4,DRAW_TED_DIRT_LEFT8,Draw_Object_32
  1107. Draw_Ted_Dirt_Left8
  1108.     subq.l    #2,d2
  1109.     DRAW_COMP_TRANS    IM_TED_DIRT_LEFT8,DRAW_TED_DIRT_LEFT12,Draw_Object_32
  1110. Draw_Ted_Dirt_Left12
  1111.     subq.l    #2,d2
  1112.     DRAW_COMP_TRANS    IM_TED_DIRT_LEFT12,DRAW_TED,Draw_Object_32
  1113.  
  1114. Draw_Ted_Dirt_Right0
  1115.     DRAW_COMP_TRANS    IM_TED_DIRT_RIGHT0,DRAW_TED_DIRT_RIGHT4,Draw_Object_32
  1116. Draw_Ted_Dirt_Right4
  1117.     DRAW_COMP_TRANS    IM_TED_DIRT_RIGHT4,DRAW_TED_DIRT_RIGHT8,Draw_Object_32
  1118. Draw_Ted_Dirt_Right8
  1119.     DRAW_COMP_TRANS    IM_TED_DIRT_RIGHT8,DRAW_TED_DIRT_RIGHT12,Draw_Object_32
  1120. Draw_Ted_Dirt_Right12
  1121.     DRAW_COMP_TRANS    IM_TED_DIRT_RIGHT12,DRAW_TED,Draw_Object_32
  1122.  
  1123. Draw_Ted_Rock_Left0
  1124.     subq.l    #4,d2
  1125.     DRAW_COMP_TRANS    IM_TED_ROCK_LEFT0,DRAW_TED_ROCK_LEFT4,Draw_Object_48
  1126. Draw_Ted_Rock_Left4
  1127.     subq.l    #4,d2
  1128.     DRAW_COMP_TRANS    IM_TED_ROCK_LEFT4,DRAW_TED_ROCK_LEFT8,Draw_Object_48
  1129. Draw_Ted_Rock_Left8
  1130.     subq.l    #4,d2
  1131.     DRAW_COMP_TRANS    IM_TED_ROCK_LEFT8,DRAW_TED_ROCK_LEFT12,Draw_Object_48
  1132. Draw_Ted_Rock_Left12
  1133.     subq.l    #4,d2
  1134.     DRAW_COMP_TRANS    IM_TED_ROCK_LEFT12,DRAW_TED,Draw_Object_48
  1135.  
  1136. Draw_Ted_Rock_Right0
  1137.     DRAW_COMP_TRANS    IM_TED_ROCK_RIGHT0,DRAW_TED_ROCK_RIGHT4,Draw_Object_48
  1138. Draw_Ted_Rock_Right4
  1139.     DRAW_COMP_TRANS    IM_TED_ROCK_RIGHT4,DRAW_TED_ROCK_RIGHT8,Draw_Object_48
  1140. Draw_Ted_Rock_Right8
  1141.     DRAW_COMP_TRANS    IM_TED_ROCK_RIGHT8,DRAW_TED_ROCK_RIGHT12,Draw_Object_48
  1142. Draw_Ted_Rock_Right12
  1143.     DRAW_COMP_TRANS    IM_TED_ROCK_RIGHT12,DRAW_TED,Draw_Object_48
  1144.  
  1145. Draw_Ted_Down0
  1146.     DRAW_COMP_TRANS    IM_TED_DOWN0,DRAW_TED_DOWN4,Draw_Object_Full_Down_32
  1147. Draw_Ted_Down4
  1148.     DRAW_COMP_TRANS    IM_TED_DOWN4,DRAW_TED_DOWN8,Draw_Object_Full_Down_32
  1149. Draw_Ted_Down8
  1150.     DRAW_COMP_TRANS    IM_TED_DOWN8,DRAW_TED_DOWN12,Draw_Object_Full_Down_32
  1151. Draw_Ted_Down12
  1152.     DRAW_COMP_TRANS    IM_TED_DOWN12,DRAW_TED,Draw_Object_Full_Down_32
  1153.  
  1154. Draw_Ted_Up0
  1155.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1156.     DRAW_COMP_TRANS    IM_TED_UP0,DRAW_TED_UP4,Draw_Object_Full_Down_32
  1157. Draw_Ted_Up4
  1158.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1159.     DRAW_COMP_TRANS    IM_TED_UP4,DRAW_TED_UP8,Draw_Object_Full_Down_32
  1160. Draw_Ted_Up8
  1161.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1162.     DRAW_COMP_TRANS    IM_TED_UP8,DRAW_TED_UP12,Draw_Object_Full_Down_32
  1163. Draw_Ted_Up12
  1164.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1165.     DRAW_COMP_TRANS    IM_TED_UP12,DRAW_TED,Draw_Object_Full_Down_32
  1166.  
  1167. Draw_Rock_Down0
  1168.     DRAW_COMP_TRANS    IM_ROCK_DOWN0,DRAW_ROCK_DOWN4,Draw_Object_Full_Down_32
  1169. Draw_Rock_Down4
  1170.     DRAW_COMP_TRANS    IM_ROCK_DOWN4,DRAW_ROCK_DOWN8,Draw_Object_Full_Down_32
  1171. Draw_Rock_Down8
  1172.     DRAW_COMP_TRANS    IM_ROCK_DOWN8,DRAW_ROCK_DOWN12,Draw_Object_Full_Down_32
  1173. Draw_Rock_Down12
  1174.     DRAW_COMP_TRANS    IM_ROCK_DOWN12,DRAW_ROCK,Draw_Object_Full_Down_32
  1175.  
  1176. Draw_Mover_Down0
  1177.     DRAW_COMP_TRANS    IM_MOVER_DOWN0,DRAW_MOVER_DOWN4,Draw_Object_Full_Down_32
  1178. Draw_Mover_Down4
  1179.     DRAW_COMP_TRANS    IM_MOVER_DOWN4,DRAW_MOVER_DOWN8,Draw_Object_Full_Down_32
  1180. Draw_Mover_Down8
  1181.     DRAW_COMP_TRANS    IM_MOVER_DOWN8,DRAW_MOVER_DOWN12,Draw_Object_Full_Down_32
  1182. Draw_Mover_Down12
  1183.     DRAW_COMP_TRANS    IM_MOVER_DOWN12,DRAW_MOVER,Draw_Object_Full_Down_32
  1184.  
  1185. Draw_Butterfly_Down0
  1186.     DRAW_COMP_TRANS    IM_BUTTERFLY_DOWN0,DRAW_BUTTERFLY_DOWN4,Draw_Object_Full_Down_32
  1187. Draw_Butterfly_Down4
  1188.     DRAW_COMP_TRANS    IM_BUTTERFLY_DOWN4,DRAW_BUTTERFLY_DOWN8,Draw_Object_Full_Down_32
  1189. Draw_Butterfly_Down8
  1190.     DRAW_COMP_TRANS    IM_BUTTERFLY_DOWN8,DRAW_BUTTERFLY_DOWN12,Draw_Object_Full_Down_32
  1191. Draw_Butterfly_Down12
  1192.     DRAW_COMP_TRANS    IM_BUTTERFLY_DOWN12,DRAW_BUTTERFLY,Draw_Object_Full_Down_32
  1193.  
  1194. Draw_Diamond_Down0
  1195.     DRAW_COMP_TRANS    IM_DIAMOND_DOWN0,DRAW_DIAMOND_DOWN4,Draw_Object_Full_Down_32
  1196. Draw_Diamond_Down4
  1197.     DRAW_COMP_TRANS    IM_DIAMOND_DOWN4,DRAW_DIAMOND_DOWN8,Draw_Object_Full_Down_32
  1198. Draw_Diamond_Down8
  1199.     DRAW_COMP_TRANS    IM_DIAMOND_DOWN8,DRAW_DIAMOND_DOWN12,Draw_Object_Full_Down_32
  1200. Draw_Diamond_Down12
  1201.     DRAW_COMP_TRANS    IM_DIAMOND_DOWN12,DRAW_DIAMOND,Draw_Object_Full_Down_32
  1202.  
  1203. Draw_Mover_Up0
  1204.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1205.     DRAW_COMP_TRANS    IM_MOVER_UP0,DRAW_MOVER_UP4,Draw_Object_Full_Down_32
  1206. Draw_Mover_Up4
  1207.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1208.     DRAW_COMP_TRANS    IM_MOVER_UP4,DRAW_MOVER_UP8,Draw_Object_Full_Down_32
  1209. Draw_Mover_Up8
  1210.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1211.     DRAW_COMP_TRANS    IM_MOVER_UP8,DRAW_MOVER_UP12,Draw_Object_Full_Down_32
  1212. Draw_Mover_Up12
  1213.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1214.     DRAW_COMP_TRANS    IM_MOVER_UP12,DRAW_MOVER,Draw_Object_Full_Down_32
  1215.  
  1216. Draw_Butterfly_Up0
  1217.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1218.     DRAW_COMP_TRANS    IM_BUTTERFLY_UP0,DRAW_BUTTERFLY_UP4,Draw_Object_Full_Down_32
  1219. Draw_Butterfly_Up4
  1220.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1221.     DRAW_COMP_TRANS    IM_BUTTERFLY_UP4,DRAW_BUTTERFLY_UP8,Draw_Object_Full_Down_32
  1222. Draw_Butterfly_Up8
  1223.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1224.     DRAW_COMP_TRANS    IM_BUTTERFLY_UP8,DRAW_BUTTERFLY_UP12,Draw_Object_Full_Down_32
  1225. Draw_Butterfly_Up12
  1226.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1227.     DRAW_COMP_TRANS    IM_BUTTERFLY_UP12,DRAW_BUTTERFLY,Draw_Object_Full_Down_32
  1228.  
  1229. Draw_Ted_Dirt_Down0
  1230.     DRAW_COMP_TRANS    IM_TED_DIRT_DOWN0,DRAW_TED_DIRT_DOWN4,Draw_Object_Full_Down_32
  1231. Draw_Ted_Dirt_Down4
  1232.     DRAW_COMP_TRANS    IM_TED_DIRT_DOWN4,DRAW_TED_DIRT_DOWN8,Draw_Object_Full_Down_32
  1233. Draw_Ted_Dirt_Down8
  1234.     DRAW_COMP_TRANS    IM_TED_DIRT_DOWN8,DRAW_TED_DIRT_DOWN12,Draw_Object_Full_Down_32
  1235. Draw_Ted_Dirt_Down12
  1236.     DRAW_COMP_TRANS    IM_TED_DIRT_DOWN12,DRAW_TED,Draw_Object_Full_Down_32
  1237.  
  1238. Draw_Ted_Dirt_Up0
  1239.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1240.     DRAW_COMP_TRANS    IM_TED_DIRT_UP0,DRAW_TED_DIRT_UP4,Draw_Object_Full_Down_32
  1241. Draw_Ted_Dirt_Up4
  1242.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1243.     DRAW_COMP_TRANS    IM_TED_DIRT_UP4,DRAW_TED_DIRT_UP8,Draw_Object_Full_Down_32
  1244. Draw_Ted_Dirt_Up8
  1245.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1246.     DRAW_COMP_TRANS    IM_TED_DIRT_UP8,DRAW_TED_DIRT_UP12,Draw_Object_Full_Down_32
  1247. Draw_Ted_Dirt_Up12
  1248.     sub.l    #GRID_OBJECT_HEIGHT*BM_width,d2
  1249.     DRAW_COMP_TRANS    IM_TED_DIRT_UP12,DRAW_TED,Draw_Object_Full_Down_32
  1250.  
  1251. *********************************************
  1252.  
  1253. *
  1254. * Show_Time -
  1255. *
  1256.  
  1257. Show_Time ; (status_planes,image_planes),a3,a4
  1258.  
  1259. ShT_REGS    REG    D5/D6/A5
  1260.  
  1261.     movem.l    ShT_REGS,-(sp)
  1262.  
  1263. * Display Time Left
  1264.     lea    time,a5
  1265.     move.w    #4-1,d6
  1266.     moveq    #0,d5
  1267. .ll0
  1268.     moveq    #0,d1
  1269. * Get Digit
  1270.     move.b    (a5)+,d1
  1271. * Calc Digit Graph Image Address
  1272.     lsl.l    #1,d1
  1273.     add.l    #IM_DIGITS,d1
  1274.     move.l    d5,d0
  1275. * Draw Digit
  1276.     bsr    Draw_ST_Object
  1277.     addq.l    #2,d5
  1278.     dbra    d6,.ll0
  1279.  
  1280. .exit    movem.l    (sp)+,ShT_REGS
  1281.     rts
  1282.  
  1283. *
  1284. * Update_Time - 
  1285. *
  1286.  
  1287. Update_Time
  1288.     move.w    time_flag,d0
  1289.     cmp.w    #TIMESUP,d0
  1290.     beq    .exit
  1291.  
  1292.     move.w    integer_time,d0
  1293.     subq.w    #1,d0
  1294.     move.w    d0,integer_time
  1295.  
  1296.     lea    time,a0
  1297. * Cijfer 1
  1298.     move.b    3(a0),d0
  1299.     subq.b    #1,d0
  1300.     bpl    .ll1
  1301.     move.b    #9,3(a0)
  1302. * Cijfer 2
  1303.     move.b    2(a0),d0
  1304.     subq.b    #1,d0
  1305.     bpl.s    .ll2
  1306.     move.b    #9,2(a0)
  1307. * Cijfer 3
  1308.     move.b    1(a0),d0
  1309.     subq.b    #1,d0
  1310.     bpl.s    .ll3
  1311.     move.b    #9,1(a0)
  1312. * Cijfer 4
  1313.     move.b    (a0),d0
  1314.     subq.b    #1,d0
  1315.     bpl.s    .ll4
  1316.     move.w    #0,integer_time
  1317.     move.w    #TIMESUP,time_flag
  1318.     move.b    #10,(a0)
  1319.     move.b    #11,1(a0)
  1320.     move.b    #12,2(a0)
  1321.     move.b    #13,3(a0)
  1322.     rts
  1323. .ll4    move.b    d0,(a0)
  1324.     rts
  1325. .ll3    move.b    d0,1(a0)
  1326.     rts
  1327. .ll2    move.b    d0,2(a0)
  1328.     rts
  1329. .ll1    move.b    d0,3(a0)
  1330. .exit    rts
  1331.  
  1332. *
  1333. * Update_Score -
  1334. *
  1335.  
  1336. Update_Score ; 
  1337.     move.w    #1,score_dirty
  1338.  
  1339.     move.w    integer_score,d0
  1340.     addq.w    #1,d0
  1341.     move.w    d0,integer_score
  1342.  
  1343. * Dit Ted reach the game target.
  1344.     cmp.w    integer_target,d0
  1345.     blo    .more_to_go
  1346.     move.w    #TRUE,ted_reach_limit
  1347. .more_to_go
  1348.  
  1349.     lea    score,a0
  1350. * Cijfer 1
  1351.     move.b    2(a0),d0
  1352.     addq.b    #1,d0
  1353.     cmp.b    #10,d0
  1354.     bne.s    .ll1
  1355.     move.b    #0,2(a0)
  1356. * Cijfer 2
  1357.     move.b    1(a0),d0
  1358.     addq.b    #1,d0
  1359.     cmp.b    #10,d0
  1360.     bne.s    .ll2
  1361.     move.b    #0,1(a0)
  1362. * Cijfer 3
  1363.     move.b    (a0),d0
  1364.     addq.b    #1,d0
  1365.     cmp.b    #10,d0
  1366.     bne.s    .ll3
  1367.     move.b    #0,0(a0)
  1368.     rts
  1369. .ll3    move.b    d0,(a0)
  1370.     rts
  1371. .ll2    move.b    d0,1(a0)
  1372.     rts
  1373. .ll1    move.b    d0,2(a0)
  1374.     rts
  1375.  
  1376. *
  1377. * Show_Score -
  1378. *
  1379.  
  1380. Show_Score ; (status_planes,image_planes),a3,a4
  1381.  
  1382. ShS_REGS    REG    D5/D6/A5
  1383.  
  1384.     movem.l    ShS_REGS,-(sp)
  1385.     lea    score,a5
  1386.     move.w    #3-1,d6
  1387.     move.l    #14,d5
  1388. .ll0    moveq    #0,d1
  1389. * Get Digit
  1390.     move.b    (a5)+,d1
  1391. * Calc Digit Graph Image Address
  1392.     lsl.l    #1,d1
  1393.     add.l    #IM_DIGITS,d1
  1394.     move.l    d5,d0
  1395. * Draw Digit
  1396.     bsr    Draw_ST_Object
  1397.     addq.l    #2,d5
  1398.     dbra    d6,.ll0
  1399.     movem.l    (sp)+,ShS_REGS
  1400.     rts
  1401.  
  1402. *
  1403. * Show_Target - Show The Target Score in status display
  1404. *
  1405.  
  1406. Show_Target ; (status_planes,image_planes),a3,a4
  1407.  
  1408. ShTS_REGS    REG    D5/D6/A5
  1409.  
  1410.     movem.l    ShTS_REGS,-(sp)
  1411.     lea    target,a5
  1412.     move.w    #3-1,d6
  1413.     move.l    #24,d5
  1414. .ll0    moveq    #0,d1
  1415. * Get Digit
  1416.     move.b    (a5)+,d1
  1417. * Calc Digit Graph Image Address
  1418.     lsl.l    #1,d1
  1419.     add.l    #IM_DIGITS,d1
  1420.     move.l    d5,d0
  1421. * Draw Digit
  1422.     bsr    Draw_ST_Object
  1423.     addq.l    #2,d5
  1424.     dbra    d6,.ll0
  1425.     movem.l    (sp)+,ShTS_REGS
  1426.     rts
  1427.  
  1428.  
  1429. *
  1430. * Draw_ST_Object
  1431. *
  1432. * A0 - plane pointer         D0 - Offset into display bitmap
  1433. * A1 - plane pointer         D1 - Offset into graphics image bitmap
  1434. * A3 - display planes        D2 - y_count
  1435. * A4 - image planes          D3 - BM_width
  1436. *                            D4 - depth count
  1437. *                            D5 - GRAPHICS_width
  1438. *
  1439.  
  1440. Draw_ST_Object ; (display_planes,image_planes,offset_disp,offset_image)
  1441. *                 A3             A4           D0          D1
  1442.  
  1443. Drtst_REGS    REG    D2/D3/D4/D5
  1444.  
  1445.     movem.l    Drtst_REGS,-(sp)
  1446.  
  1447.     moveq    #GRAPHICS_width,d5
  1448.     moveq    #ST_BM_x/8,d3
  1449.     moveq    #4*(GRAPHICS_d-1),d4
  1450. .ll0    moveq    #GRID_OBJECT_HEIGHT-1,d2
  1451.     move.l    (a3,d4.w),a0
  1452.     move.l    (a4,d4.w),a1
  1453.     add.l    d0,a0
  1454.     add.l    d1,a1
  1455. .ll1    move.w    (a1),(a0)
  1456.     add.l    d3,a0
  1457.     add.l    d5,a1
  1458.     dbra    d2,.ll1
  1459.     subq.w    #4,d4
  1460.     bpl.s    .ll0
  1461.  
  1462.     movem.l    (sp)+,Drtst_REGS
  1463.     rts
  1464.  
  1465.  
  1466. *********************************************
  1467. **  Scroll Data  Scroll Data  Scroll Data  **
  1468. *********************************************
  1469.  
  1470. ted_bitmap_x        dc.l    0    grids
  1471. ted_bitmap_y        dc.l    0    grids
  1472. ted_grid_field_x    dc.l    0    grids
  1473. ted_grid_field_y    dc.l    0    grids
  1474. animate_offset_x    dc.l    0    grids
  1475. animate_offset_y    dc.l    0    grids
  1476.  
  1477. flag_scroll_left    dc.w    0
  1478. flag_scroll_right    dc.w    0
  1479. flag_scroll_up        dc.w    0
  1480. flag_scroll_down    dc.w    0
  1481.  
  1482. left_row_update        dc.l    0    grid_field row that will disapear
  1483. right_row_update    dc.l    0    grid_field row that will disapear
  1484. upper_row_update    dc.l    0    grid_field row that will disapear
  1485. lower_row_update    dc.l    0    grid_field row that will disapear
  1486.  
  1487. flag_view_scroll_left    dc.w    0
  1488. flag_view_scroll_right    dc.w    0
  1489. flag_view_scroll_up    dc.w    0
  1490. flag_view_scroll_down    dc.w    0
  1491.  
  1492. ************************************************
  1493.  
  1494. time        dc.b    5,0,0,0
  1495. score        dc.b    0,0,0
  1496. target        dc.b    6,7,0
  1497.         even
  1498. score_dirty    dc.w    0
  1499. integer_time    dc.w    0
  1500. integer_target    dc.w    0
  1501. integer_score    dc.w    0
  1502. time_flag    dc.w    0
  1503. ted_wins_flag    dc.w    0
  1504. ted_reach_limit    dc.w    0
  1505.